<template>
	<view :style="theme">
		<view style="height: 30rpx;"></view>
		<view class="cardCont">
			<view v-for="(item, index) in list" :key="index" class="box_item mb3 flex" @click="tzDetail(item)">
				<image class="logoImg" :src="item.logoFull?item.logoFull:imgHost+'/default_changguan.jpg'"></image>
				<view class="cont">
					<view class="f30 fwb c3">{{item.name}}</view>
					<view class="f26 c6 mt10">营业时间：{{item.openTime}}</view>
					<view v-if="item.address" class="flex f26 c6 mt10">
						<image class="box_switch_left_imga" :src="imgHost+'/home_ic_location.png'"
							style="width: 24rpx;height: 24rpx;margin-right:10rpx;flex: none;"></image>
						<text>{{item.address}}</text>
					</view>
					<view v-if="item.distance" class="f26 c6 mt10">{{item.distance}}</view>
				</view>
			</view>
		</view>
		<u-loadmore v-if="end && list.length >= 10" :status="status" line />
		<view v-if="list.length === 0" class="no-order">
			<image :src="imgHost+'/default_nodata.png'"></image>
			<view>暂无自提点～</view>
		</view>
	</view>
</template>

<script>
	import { mapState } from "vuex";
	import HotVen from "@/components/hotVen.vue";
	export default {
		components: {
			HotVen
		},
		data() {
			return {
				list: [],
				page: 1,
				end: false,
				firstQueryTime: '',
				status: 'nomore',
			}
		},
		onShow() {
			this.searchBtn()
		},
		methods: {
			jump(url, params, a) {
				this.$app.jump(url, params, a);
			},
			jump2(url, params, a) {
				this.$app.jump2(url, params, a);
			},
			//单张图片预览
			previewImg(imgurl) {
				let _this = this;
				let imgsArray = [];
				imgsArray[0] = imgurl
				uni.previewImage({
					current: 0,
					urls: imgsArray
				});
			},
			tzDetail(item) {
				uni.$emit("callback3", item);
				uni.navigateBack({
					delta: 1
				})
			},
			searchBtn() {
				this.firstQueryTime = this.$app.firstQueryTime()
				this.list = [];
				this.page = 1;
				this.end = false;
				this.getList()
			},
			getList() {
				this.$app.ajax({
					data: {
						pagination: {
							firstQueryTime: this.firstQueryTime,
							page: this.page,
							rows: 10
						},
						param: {}
					},
					api: this.$api.selectByPageListForMini()
				}).then((res) => {
					if (res.errorCode === '000000') {
						if (!res.recordList || res.recordList.length < 10) {
							this.end = true
						}
						if (res.recordList) {
							this.list = this.list.concat(res.recordList)
						}
					}
				}).catch(() => {})
			},
			reachBottom() {
				if (!this.end) {
					this.page += 1;
					this.getList();
				}
			},
			// 触底加载更多数据
			onReachBottom(e) {
				this.reachBottom()
			}

		}

	}
</script>
<style lang="scss" scoped>
	.cardCont {
		.box_item {
			width: 100%;
			background: #FFFFFF;
			border-radius: 8rpx;
			position: relative;
			overflow: hidden;
			box-sizing: border-box;
			padding: 20rpx;
			.logoImg {
				width: 120rpx;
				margin-right: 20rpx;
				height: 120rpx;
				flex: none;
				border-radius: 16rpx;
				overflow: hidden;
			}
		}
	}
</style>